package Controllers;

import Exceptions.DaoException;
import Models.Login;
import Interfaces.ILogin_Dao;
import javax.swing.JOptionPane;

public class Login_Controller {

    private ILogin_Dao x;

    public Login_Controller(ILogin_Dao x) {
        this. x = x;
    }

    Login_Controller() {

    }

    public Login Validate(String Name, String Pass)
            throws IllegalArgumentException, DaoException {

        if (Name.isEmpty() || Pass.isEmpty()) {
           JOptionPane.showMessageDialog(null,"Empty Username Or Password");

        }
        try {
            return x.ValidateLogin(Name, Pass);
        } catch (DaoException e) {
            throw e;
        }

    }
}
